package com.study.core.error;

/**
 * @Description 业务异常
 * @Author dangxianyue
 * @Date 2024/5/31 10:35
 */
public class BizException extends RuntimeException implements ErrorCodeMsg {
    private Integer code;

    public BizException(Throwable cause) {
        super(cause);
    }

    public BizException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BizException(ErrorCodeMsg errorCodeMsg) {
        super(errorCodeMsg.getMsg());
        this.code = errorCodeMsg.getCode();
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.getMessage();
    }
}
